package en.edu.zxj.springrabbimqdemo.listener;

import en.edu.zxj.springrabbimqdemo.constant.Constants;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/**
 * Created with IntelliJ IDEA.
 * Description：
 *
 * @author: zxj
 * @date: 2024-09-20
 * @time: 13:58:55
 */
@Component
public class WorkListener {
    // 监听工作模式队列
    @RabbitListener(queues = Constants.WORK_QUEUE_NAME)
    public void listenerQueue(String message) {
        System.out.println("listener1 消费消息：" + message);
    }

    @RabbitListener(queues = Constants.WORK_QUEUE_NAME)
    public void listenerQueue2(Message message) {
        System.out.println("listener2 消费消息：" + message.toString());
    }
}
